/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gm.entities;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Med EL MOUDDENE
 */
@Entity
@Table(name = "dossier_medical")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DossierMedical.findAll", query = "SELECT d FROM DossierMedical d"),
    @NamedQuery(name = "DossierMedical.findByIdDossier", query = "SELECT d FROM DossierMedical d WHERE d.idDossier = :idDossier"),
    @NamedQuery(name = "DossierMedical.findByDateDossier", query = "SELECT d FROM DossierMedical d WHERE d.dateDossier = :dateDossier")})
public class DossierMedical implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_DOSSIER")
    private Integer idDossier;
    @Lob
    @Size(max = 65535)
    @Column(name = "IDENTITE")
    private String identite;
    @Column(name = "DATE_DOSSIER")
    @Temporal(TemporalType.DATE)
    private Date dateDossier;
    @Lob
    @Size(max = 65535)
    @Column(name = "HISTOIRE_MALADIE")
    private String histoireMaladie;
    @Lob
    @Size(max = 65535)
    @Column(name = "CONCLUSION_CLINIQUE")
    private String conclusionClinique;
    @JoinColumn(name = "ID_PERSONNE", referencedColumnName = "ID_PERSONNE")
    @ManyToOne(optional = false)
    private Personne idPersonne;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idDossier")
    private Collection<Orientation> orientationCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idDossier")
    private Collection<Suivi> suiviCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idDossier")
    private Collection<Bilan> bilanCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idDossier")
    private Collection<Atcd> atcdCollection;

    public DossierMedical() {
    }

    public DossierMedical(Integer idDossier) {
        this.idDossier = idDossier;
    }

    public Integer getIdDossier() {
        return idDossier;
    }

    public void setIdDossier(Integer idDossier) {
        this.idDossier = idDossier;
    }

    public String getIdentite() {
        return identite;
    }

    public void setIdentite(String identite) {
        this.identite = identite;
    }

    public Date getDateDossier() {
        return dateDossier;
    }

    public void setDateDossier(Date dateDossier) {
        this.dateDossier = dateDossier;
    }

    public String getHistoireMaladie() {
        return histoireMaladie;
    }

    public void setHistoireMaladie(String histoireMaladie) {
        this.histoireMaladie = histoireMaladie;
    }

    public String getConclusionClinique() {
        return conclusionClinique;
    }

    public void setConclusionClinique(String conclusionClinique) {
        this.conclusionClinique = conclusionClinique;
    }

    public Personne getIdPersonne() {
        return idPersonne;
    }

    public void setIdPersonne(Personne idPersonne) {
        this.idPersonne = idPersonne;
    }

    @XmlTransient
    public Collection<Orientation> getOrientationCollection() {
        return orientationCollection;
    }

    public void setOrientationCollection(Collection<Orientation> orientationCollection) {
        this.orientationCollection = orientationCollection;
    }

    @XmlTransient
    public Collection<Suivi> getSuiviCollection() {
        return suiviCollection;
    }

    public void setSuiviCollection(Collection<Suivi> suiviCollection) {
        this.suiviCollection = suiviCollection;
    }

    @XmlTransient
    public Collection<Bilan> getBilanCollection() {
        return bilanCollection;
    }

    public void setBilanCollection(Collection<Bilan> bilanCollection) {
        this.bilanCollection = bilanCollection;
    }

    @XmlTransient
    public Collection<Atcd> getAtcdCollection() {
        return atcdCollection;
    }

    public void setAtcdCollection(Collection<Atcd> atcdCollection) {
        this.atcdCollection = atcdCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDossier != null ? idDossier.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DossierMedical)) {
            return false;
        }
        DossierMedical other = (DossierMedical) object;
        if ((this.idDossier == null && other.idDossier != null) || (this.idDossier != null && !this.idDossier.equals(other.idDossier))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.gm.entities.DossierMedical[ idDossier=" + idDossier + " ]";
    }
    
}
